package com.apexsoft.monitor.front.console.app.om;

import com.apexsoft.front.common.utils.SpringContextUtil;
import com.apexsoft.monitor.front.console.app.service.AppService;
import com.apexsoft.monitor.front.console.host.om.Host;
import com.apexsoft.monitor.front.console.host.service.HostService;
import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;

/**
 * 应用节点
 */
@TableName("t_app_node")
public class AppNode {
	
	
	@TableId(type = IdType.AUTO)
	private int id;
	@TableField(value="node_code")
	private String nodeCode;
	@TableField(value="node_name")
	private String nodeName;
	@TableField(value="node_type")
	private String nodeType;
	@TableField(value="app_code")
	private String appCode;
	@TableField(value="host_code")
	private String hostCode;
	@TableField(value="service_port")
	private int servicePort;
	@TableField(value="template_code")
	private String templateCode;
	@TableField(value="status")
	private int status;
	@TableField(value="node_desc")
	private String nodeDesc;

	@TableField(value="base_path")
	private String basePath;

	@TableField(value="node_link")
	private String nodeLink;



	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}

	public String getNodeCode() {
		return nodeCode;
	}

	public void setNodeCode(String nodeCode) {
		this.nodeCode = nodeCode;
	}

	public String getNodeName() {
		return nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	public String getAppName(){
		AppService appService = (AppService)SpringContextUtil.getBean("appService");
		App app = appService.getByAppCode(this.getAppCode());
		return app==null?"data not found":app.getAppName();
	}


	public String getHostName(){
		HostService hostService = (HostService)SpringContextUtil.getBean("hostService");
		Host host = hostService.getByCode(this.getHostCode());
		return host==null?"data not found":host.getHostName();
	}

	public String getAppCode() {
		return appCode;
	}

	public void setAppCode(String appCode) {
		this.appCode = appCode;
	}

	public String getHostCode() {
		return hostCode;
	}

	public void setHostCode(String hostCode) {
		this.hostCode = hostCode;
	}

	public int getServicePort() {
		return servicePort;
	}

	public void setServicePort(int servicePort) {
		this.servicePort = servicePort;
	}

	public String getTemplateCode() {
		return templateCode;
	}

	public void setTemplateCode(String templateCode) {
		this.templateCode = templateCode;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getNodeDesc() {
		return nodeDesc;
	}

	public void setNodeDesc(String nodeDesc) {
		this.nodeDesc = nodeDesc;
	}

	public String getBasePath() {
		return basePath;
	}

	public void setBasePath(String basePath) {
		this.basePath = basePath;
	}

	public String getNodeType() {
		return nodeType;
	}

	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}

	public String getNodeLink() {
		return nodeLink;
	}

	public void setNodeLink(String nodeLink) {
		this.nodeLink = nodeLink;
	}
}
